# coding=utf-8
import requests,re
class Smmulv(object):
	header={'User-Agent':'Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36'}
	def  __init__(self):
		pass
	def Sm(self,line,dic):

		with open(dic,'r') as fo:
			for li in fo.readlines():
				ur = line.strip('\n')+li.strip('\n')
				print ur
				ur1 = re.findall(r"(http)",ur)
				#print ur1
				if ur1:#本身为False，满足条件执行
					#print '存在http'
					pd = requests.head(url=ur,allow_redirects=False,verify=False,headers=self.header)
					de = pd.status_code
					print de
					if de == 200 or de == 301:
						a = '<a target=_blank href='+ur+'>'+ur+"========>   "+str(de)+'</a><br>'
						print a
						# jg_url = open('web/1.html',"ab+")
						# jg_url.write(a+'\n')
						# jg_url.close()
				else:
					#print '不存在http'
					pd = requests.head(url="http://"+ur,allow_redirects=False,verify=False,headers=self.header)
					de = pd.status_code
					print de
					if de == 200 or de == 301:
						a = '<a target=_blank href=http://'+ur+'>'+ur+"========>   "+str(de)+'</a><br>'
						print a
						# jg_url = open('web/1.html',"ab+")
						# jg_url.write(a+'\n')
						# jg_url.close()



# wz =Smmulv()
# dic = 'dict/a.txt'
# wz.Sm('http://www.iguoli.cn',dic)